package service

import (
	"context"
	"devops-super/api/clusters/v1"
)

// IDistributeFiles 文件分发服务接口
type IDistributeFiles interface {
	// GetDirList 获取根目录列表
	GetDirList(ctx context.Context, serverKey string) (res *v1.DistributeFilesGetDirListRes, err error)
	// GetSubDirList 获取子目录列表
	GetSubDirList(ctx context.Context, serverKey, path string) (res *v1.DistributeFilesGetSubDirListRes, err error)
	// DeleteDir 删除目录
	DeleteDir(ctx context.Context, serverKey, path string) (err error)
}

var localDistributeFiles IDistributeFiles

// DistributeFiles 获取文件分发服务实例
func DistributeFiles() IDistributeFiles {
	if localDistributeFiles == nil {
		panic("implement not found for interface IDistributeFiles, forgot register?")
	}
	return localDistributeFiles
}

// RegisterDistributeFiles 注册文件分发服务
func RegisterDistributeFiles(i IDistributeFiles) {
	localDistributeFiles = i
}